package com.eduadmin.service;

import com.eduadmin.entity.AdminUser;
import com.eduadmin.mapper.AdminUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AdminLoginServiceImpl implements IAdminLoginService{
    private final AdminUserMapper adminUserMapper;
    @Autowired
    public  AdminLoginServiceImpl(AdminUserMapper adminUserMapper){
        this.adminUserMapper = adminUserMapper;
    }
    @Override
    public AdminUser getAdminByName(String username) {
        return adminUserMapper.getAdminUser(username);
    }

    @Override
    public List<AdminUser> getAllAdminUser(Map<String, Object> paraMap) {
        return adminUserMapper.selectAllAdminUser(paraMap);
    }

    @Override
    public Long getAllTotal(Map<String, Object> paraMap) {
        return adminUserMapper.selectAdminUserCount(paraMap);
    }

    @Override
    public void addAdminUser(AdminUser adminUser) {
        adminUserMapper.insertNewAdminUser(adminUser);
    }

    @Override
    public void editAdminUser(AdminUser adminUser) {
        adminUserMapper.updateAdminUser(adminUser);
    }

    @Override
    public int deleteAdminUser(String adminidString) {
        return adminUserMapper.deleteAdminUser(adminidString);
    }
}
